<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>ta交易数据表</title>
    <!--导入layui相关的样式-->
    <link rel="stylesheet" href="../layui/css/layui.css" media="all">
    <!-- 导入layui函数库 -->
    <script src="../layui/layui.js" charset="utf-8"></script>
    <!--加载jQuery函数库-->
    <script src="../jQuery/jquery-1.11.2.js"></script>
    <script type="text/javascript" src="/jQuery/jQuery.form.js"></script>
    <!-- 注意：导入外部库的时候要注意改成自己的路径 -->
    <link rel="stylesheet" type="text/css" href="/css/font.css">
</head>
<body>
<blockquote class="layui-elem-quote news_search">
        <!-- 表格头部上方工具栏 -->
        <script type="text/html" id="complain_toolbar">
        <!-- 多条件查询层开始-->
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so" id="tabase_search">
                交易日期:
                <div class="layui-input-inline">
                    <input type="date" name="dates" id="dates"
                           placeholder="请输入交易日期" autocomplete="off" class="layui-input">
                </div>
                交易类型：
                <div class="layui-input-inline">
                    <select name="tranType" id="tranType">
                        <option value="">---请选择---</option>
                        <option value="1">认购</option>
                        <option value="2">申购</option>
                        <option value="3">赎回</option>
                    </select>
                </div>
                <button id="search" class="layui-btn layui-btn-primary layui-bg-gray" lay-submit data-type="reload"
                        lay-filter="provinceSearch">
                    <i class="layui-icon">&#xe615;</i>
                </button>
                <b class="layui-btn layui-btn-sm layui-bg-blue" lay-event="lead-in"><i class="layui-icon">&#xe67d;</i>导入TA数据</b>
                <!--<b class="layui-btn layui-btn-sm layui-bg-blue"><i class="layui-icon">&#xe67d;</i>赎回导入</b>-->
                <b class="layui-btn layui-btn-sm layui-btn-danger" lay-event="batchDel"><i class="layui-icon">&#xe640;</i>批量删除</b>
                <b class="layui-btn layui-btn-sm layui-bg-blue" lay-event="add"><i class="layui-icon">&#xe654;</i>添加数据</b>
            </form>

        </div>
        </script>
        <!-- 多条件查询层结束 -->
        <!-- 数据表格 -->
        <table class="layui-hide" id="tabaseTable" lay-filter="tabaseList"></table>
    </blockquote>

<!-- 增加/修改界面开始 -->
<div id="data" style="display: none;">
    <div class="layui-row" style="margin-top:25px">
        <form class="layui-form" id="tabaseFormbyId" method="POST" lay-skin="line" lay-filter="tabaseFormTest">
            <div class="layui-form-item" >
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易编号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="dataId"  placeholder="请输入交易数据编号" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">基金ID</label>
                    <div class="layui-input-inline">
                        <input type="text" name="fundId" lay-verify="required" placeholder="请输入基金ID" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">现金账户号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="caId" lay-verify="required" placeholder="请输入现金账户ID" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item" >
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易日期</label>
                    <div class="layui-input-inline">
                        <input type="date" name="dates" lay-verify="required" placeholder="请输入交易日期" autocomplete="off"
                               class="layui-input form-control layer-date">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易数量</label>
                    <div class="layui-input-inline">
                        <input type="text" name="numbers" id="trNumber" lay-verify="required" placeholder="请输入交易数量" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">结算日期</label>
                    <div class="layui-input-inline">
                        <input type="date" name="endDate" lay-verify="required" placeholder="请输入结算日期" autocomplete="off"
                               class="layui-input form-control layer-date">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline" style="display: none">
                    <label class="layui-form-label layui-icon">总金额</label>
                    <div class="layui-input-inline">
                        <input type="text" name="sumMoney" lay-verify="required" placeholder="请输入总金额" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="display: none">
                    <label class="layui-form-label layui-icon">实际金额</label>
                    <div class="layui-input-inline">
                        <input type="text" name="actMoney" lay-verify="required" placeholder="请输入实际金额" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">单价</label>
                    <div class="layui-input-inline">
                        <input type="text" name="price" lay-verify="required" placeholder="请输入单价" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline" style="display: none">
                    <label class="layui-form-label layui-icon">费用</label>
                    <div class="layui-input-inline">
                        <input type="expenses" name="expenses"  placeholder="请输入费用" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易类型</label>
                    <div class="layui-input-inline">
                        <select name="tranType" class="layui-inline">
                            <option value="">---请选择---</option>
                            <option value="1">认购</option>
                            <option value="2">申购</option>
                            <option value="3">赎回</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易状态</label>
                    <div class="layui-input-inline">
                        <select name="tranStatus" class="layui-inline">
                            <!--                            <option value="">---请选择---</option>

                                                        <option value="1">已结算</option>
                            -->
                            <option value="2">未结算</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">代销机构</label>
                    <div class="layui-input-inline">
                        <input type="text" name="conagen" lay-verify="required" placeholder="请输入代销机构" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-col-md4 layui-col-md-offset4">
                <div class="layui-input-block">
                    <button class="layui-btn layui-bg-blue" lay-submit lay-filter="formSave">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>

<div id="lead-in" style="display: none;">
    <form method="POST"  enctype="multipart/form-data" id="form1" action="/tabasecrud/form">
        <input id="upfile" type="file"  class="layui-btn" name="upfile"  style="background: #06b535;margin-left: 90px;margin-top: 30px;"><br> <br>
        <input type="submit" value="表单提交" onclick="return checkData()"  class="layui-btn" style="margin-left: 180px;margin-top: 30px;">
        <!--<input type="button" value="ajax提交" id="btn" name="btn" >-->
    </form>
</div>



<div id="data-main" style="display: none;">
    <div class="layui-row" style="margin-top:25px">
        <form class="layui-form" id="tabaseForm" method="POST" lay-skin="line" lay-filter="tabaseFormTest">
            <div class="layui-form-item" >
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易编号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="dataId"  placeholder="请输入交易数据编号" autocomplete="off"
                               class="layui-input">
                    </div>
                </div>
                <!--<div class="layui-inline">
                    <label class="layui-form-label layui-icon">基金ID</label>
                    <div class="layui-input-inline">
                    <input type="text" name="fundId" lay-verify="required" placeholder="请输入基金ID" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>-->
                <div class="layui-inline" >
                    <label class="layui-form-label" >基金名称</label>
                    <div class="layui-input-inline">
                        <select name="fundId" id="fundId" lay-verify="required">
                            <!--<option value="0">&#45;&#45;请选择&#45;&#45;</option>
                            <option value="1">农业银行</option>
                            <option value="2">商业银行</option>
                            <option value="3">邮政银行</option>
                            <option value="4">建设银行</option>-->
                        </select>
                    </div>
                </div>
                <!--<div class="layui-inline">
                    <label class="layui-form-label layui-icon">现金账户号</label>
                    <div class="layui-input-inline">
                    <input type="text" name="caId" lay-verify="required" placeholder="请输入现金账户ID" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>-->
                <div class="layui-inline" >
                    <label class="layui-form-label" >现金账户号</label>
                    <div class="layui-input-inline">
                        <select name="caId" id="caId" lay-verify="required">
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item" >
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易日期</label>
                    <div class="layui-input-inline">
                    <input type="date" name="dates" lay-verify="required" placeholder="请输入交易日期" autocomplete="off"
                           class="layui-input form-control layer-date">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易数量</label>
                    <div class="layui-input-inline">
                    <input type="text" name="numbers" id="numbers" lay-verify="required" placeholder="请输入交易数量" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">结算日期</label>
                    <div class="layui-input-inline">
                    <input type="date" name="endDate" lay-verify="required" placeholder="请输入结算日期" autocomplete="off"
                           class="layui-input form-control layer-date">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline" style="display: none">
                <label class="layui-form-label layui-icon" >总金额</label>
                    <div class="layui-input-inline">
                    <input type="text" name="sumMoney"  placeholder="请输入总金额" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>
                <div class="layui-inline" style="display: none">
                    <label class="layui-form-label layui-icon">实际金额</label>
                    <div class="layui-input-inline">
                    <input type="text" name="actMoney"  placeholder="请输入实际金额" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">单价</label>
                    <div class="layui-input-inline">
                    <input type="text" name="price"  placeholder="请输入单价" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易类型</label>
                    <div class="layui-input-inline">
                        <select name="tranType" class="layui-inline">
                            <option value="">---请选择---</option>
                            <option value="1">认购</option>
                            <option value="2">申购</option>
                            <option value="3">赎回</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">交易状态</label>
                    <div class="layui-input-inline">
                        <select name="tranStatus" class="layui-inline">
                            <!--  <option value="">-&#45;&#45;请选择-&#45;&#45;</option>
                              <option value="1">已结算</option>-->
                            <option value="-1">未结算</option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline" style="display: none">
                <label class="layui-form-label layui-icon">费用</label>
                    <div class="layui-input-inline">
                    <input type="expenses" name="expenses"  placeholder="请输入费用" autocomplete="off"
                           class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label layui-icon">代销机构</label>
                    <div class="layui-input-inline">
                        <select name="conagen" id="conagen" >
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-col-md4 layui-col-md-offset4">
                <div class="layui-input-block">
                    <button class="layui-btn layui-bg-blue" lay-submit lay-filter="formSave">保存</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 增加/修改界面结束 -->

<!-- 行中操作按钮 [仅对本行操作]-->
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs layui-bg-blue" lay-event="update">修改</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete">删除</a>
</script>
<!-- 脚本代码 -->
<script type="text/javascript">
    layui.use(['table','layer','form','laypage','util',"jquery","laydate"],function () {
        //导入模块并得到模块对象
        var table = layui.table,//表格对象
            layer = layui.layer,//弹层对象
            form = layui.form,//表单对象
            laypage = layui.laypage,//分页组件
            $=layui.jquery,//jquery对象
            util=layui.util;//工具对象
        var laydate=layui.laydate;//日期时间对象
        var vals="";
        var valss="";
        var taSet="";
        //渲染表格对象
        table.render({
            //id:"tabaseReload",//为多条件搜索重新加载使用,存在问题：增加数据后不自动刷新
            elem: '#tabaseTable',//表格对象
            url:"/tabasecrud/method",//../json/tabaselsr.json//实际使用servlet路径(后台服务路径)
            page: true,//分页
            method:'get',//提交方式
            height:740,
            toolbar: '#complain_toolbar',//表格上方普通工具栏
            limit:15,//每页行数
            cols: [
                [
                    {checkbox:true},//开启多选框
                    {field:"dataId",title:"交易编号",align:"center",width:200,},
                    {field:"fundId",title:"基金名称",align:"center",width:200,templet:function (d) {
                            for (var i = 0; i <valss.length ; i++) {
                                if (valss[i].fundId==d.fundId){
                                    return valss[i].fundName;
                                }
                            }
                        }},
                    {field:"caId",title:"现金账户名称",align:"center",width:200,templet:function (d) {
                            for (var i = 0; i <vals.length ; i++) {
                                if (vals[i].caId==d.caId){
                                    return vals[i].accName;
                                }
                            }
                        }},
                    {field:"dates",title:"交易日期",align:"center",width:200,
                        templet:function(d){return util.toDateString(d.dates,"yyyy年MM月dd日");}},
                    {field:"numbers",title:"交易数量(支)",align:"center",width:200,templet:function (d) {
                            if (d.numbers.toString().indexOf(".")!=-1){
                                return d.numbers.toLocaleString();
                            }else{
                                return (d.numbers+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,');
                            }
                        }},
                    //如果需要注意日期格式化
                    {field:"endDate",title:"结算日期",align:"center",width:200,
                        templet:function(d){return util.toDateString(d.endDate,"yyyy年MM月dd日");}},
                    {field:"sumMoney",title:"总金额(元)",align:"center",width:200,templet:function (d) {
                            if (d.sumMoney.toString().indexOf(".")!=-1){
                                return d.sumMoney.toLocaleString();
                            }else{
                                return (d.sumMoney+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,')+".00";
                            }
                        }},
                    {field:"actMoney",title:"实际金额(元)",align:"center",width:200,templet:function (d) {
                            if (d.actMoney.toString().indexOf(".")!=-1){
                                return d.actMoney.toLocaleString();
                            }else{
                                return (d.actMoney+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,')+".00";
                            }
                        }},
                    {field:"price",title:"单价(元)",align:"center",width:200,templet:function (d) {
                            return d.price.toFixed(10);
                        }},
                    {field:"expenses",title:"费用(元)",align:"center",width:200,sort:true,templet:function (d) {
                            if (d.expenses.toString().indexOf(".")!=-1){
                                return d.expenses.toLocaleString();
                            }else{
                                return (d.expenses+ '').replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,'$1,')+".00";
                            }
                        }},
                    {field:"conagen",title:"代销机构",align:"center",width:200,templet:function (d) {
                            return "宗大证券";
                        }},
                    {field:"tranType",title:"交易类型",align:"center",width:200,templet :function(d){
                            //注意格式,此处d为对象，d.字段名来获得该字段值
                            if(d.tranType == 1){
                                return '<span style="color: #D03948;">认购</span>';
                            }else if(d.tranType == 2){
                                return '<span style="color: #18A4D0;">申购</span>';
                            }else if(d.tranType == 3){
                                return '<span style="color: #5CD03F;">赎回</span>';
                            }}},
                    {field:"tranStatus",title:"交易状态",align:"center",width:200,templet :function(d){
                            //注意格式,此处d为对象，d.字段名来获得该字段值
                            if(d.tranStatus == 1){
                                return '<span style="color: #06b535">已结算</span>';
                            }else if(d.tranStatus == -1){
                                return '<span style="color: red">未结算</span>';
                            }}},
                    {fixed: 'right', title:'操作', toolbar: '#barDemo',align:"center",width:200}
                ]
            ],
            limits: [5, 10,20,30,50], //每页行数据选择
            parseData: function(data){ //将原始数据解析成 table 组件所规定的数据
                /*$("#caId").remove();
                $("#fundId").remove();*/
                valss=data.queryFundSetpT;
                vals=data.queryCashAccountT;
                taSet=data.setting;
                var htmlVal="<option value=''>---请选择---</option>";
                var htmlVals="<option value=''>---请选择---</option>";
                var htmlValss="<option value=''>---请选择---</option>";
                //动态生成下拉框
                for (var i=0;i<vals.length;i++){
                    htmlVal+="<option value='"+vals[i].caId+"'>"+vals[i].accName+"</option>";
                }
                for (var i = 0; i < valss.length; i++) {
                    htmlVals+="<option value='"+valss[i].fundId+"'>"+valss[i].fundName+"</option>"
                }
                for (var i = 0; i <taSet.length ; i++) {
                    htmlValss+="<option value='"+taSet[i].stockId+"'>"+taSet[i].stockName+"</option>";
                }
                $("#caId").html(htmlVal);
                $("#fundId").html(htmlVals);
                $("#conagen").html(htmlValss);
                return {
                    "code": data.code, //解析接口状态
                    "msg": data.msg, //解析提示文本
                    "count": data.count, //解析数据长度
                    "data": data.data //解析数据列表
                }}
        });
        /*laydate.render({
            elem:"#dates",
            format:"yyyy-mm-dd",
            //max:laydate.now(),
            istime:true,//开启时间选择
            istoday:true
        });*/

        //$("#hiredate").val(laydate.now(0,"yyyy-MM-dd HH:mm:ss"));
        //监听添加/修改页的提交操作[该表单的提交操作] [保存按钮]
        //定义请求方式
        var method="";
        form.on('submit(formSave)', function(data){
            //ajax提交数据
            $.ajax({
                type: method,//请求方式
                url: "/tabasecrud/method",//../json/tabaselsr.json,//后台控制器路径
                data: JSON.stringify(data.field),
                dataType:"text",
                contentType:"application/json;charset=utf-8",//前端发送json字符串到后端，必需设置
                //提交成功后回调操作
                success: function(msg){
                    layer.closeAll();//关闭对话框
                    layer.msg(msg);//弹出提示框
                    table.reload('tabaseTable');//刷新数据表格
                }
            });
            return false;
        });





        //表格头部工具栏事件代码，根据lay-event属性值判断执行相应的代码
        table.on('toolbar(tabaseList)', function(obj) {
            //检查表格选择操作状态
            var checkStatus = table.checkStatus(obj.config.id);
            //判断事件event值
            switch(obj.event) {
                //批量删除操作：删除选定的多行数据
                case "batchDel":
                    //获得选中的表格行
                    var data = checkStatus.data;
                    //判断是否大于0行
                    if(data.length>0){
                        layer.confirm('请确认是否真的删除?', function(index){
                            //获取所有选择的id
                            var dataIdStr="";
                            for (var i = 0; i < data.length; i++) {
                                dataIdStr = dataIdStr+data[i].dataId+",";//累加字符
                            }
                            //去掉最后多余逗号
                            dataIdStr=dataIdStr.substring(0,dataIdStr.length-1);
                            layer.close(index);
                            //使用ajax删除选中的
                            $.ajax({
                                type: "put",//提交方式为put,替代delte请求
                                url: "/tabasecrud/batchDel?dataIdStr="+dataIdStr,//后台Servlet路径
                                success: function(msg){
                                    layer.msg('删除成功');
                                    //重新加载表格数据
                                    table.reload('tabaseTable');
                                }
                            });
                        });
                    }else{
                        //没有选择数据行
                        layer.msg('你至少选一行！');
                    }
                    break;
                case 'lead-in':
                    //设置请求方式为post,表示增加交易数据
                    method="post";
                    layer.open({
                        type: 1,//外部页面为2，内部层1
                        title: "<span style='color:white' align='center'><i class='layui-icon'>&#xe61f;</i> 导入交易数据</span>",
                        area: ['30%', '30%'],
                        fix: false,
                        maxmin: true,
                        shadeClose: true,
                        shade: 0.4,
                        skin: 'layui-layer-lan',
                        content:$("#lead-in").html(),
                        anim: 1
                    });
                    //JS校验form表单信息
                    function checkData(){
                        var fileDir = $("#upfile").val();
                        var suffix = fileDir.substr(fileDir.lastIndexOf("."));
                        if("" == fileDir){
                            alert("选择需要导入的Excel文件！");
                            return false;
                        }
                        if(".xls" != suffix && ".xlsx" != suffix ){
                            alert("选择Excel格式的文件导入！");
                            return false;
                        }
                        return true;
                    }

                    break;

                case 'add':
                    //设置请求方式为post,表示增加交易数据
                    method="post";
                    //清空表单
                    $("#tabaseForm")[0].reset();
                    layer.open({
                        type: 1,//外部页面为2，内部层1
                        title: "<span style='color:white' align='center'><i class='layui-icon'>&#xe61f;</i> 添加新交易数据</span>",
                        area: ['70%', '57%'],
                        fix: false,
                        maxmin: true,
                        shadeClose: true,
                        shade: 0.4,
                        skin: 'layui-layer-lan',
                        content:$("#data-main").html(),
                        anim: 1
                    });
                    //将主键设置成允许修改[防止因先修改，后增加时，该字段被设置为只读]
                    $("input[name='dataId']").prop("readonly",false);
                    break;
            }
        });

        //监听表格行工具(操作)事件 [不能和前面写在一起，原因二者参数有区别：前者toolbar，这里为tool]
        table.on("tool(tabaseList)",function (obj) {
            //得到表格行数据
            var data=obj.data;
            //判断事件event值，与lay-event属性比较(使用switch或if梯形结构都可以,前面已经用过switch,
            // 此处使用if梯形结构)
            //判断是否为行修改操作
            if(obj.event == "update"){
                //将设置请求方式为put
                method="put";
                //设置界面信息
                layer.open({
                    type: 1,
                    title:"<span style='color:white' ><i class='layui-icon'>&#xe6b2;</i> 修改交易数据</span>",
                    area: ['70%', '57%'],
                    shade: 0.4,
                    content: $("#data-main").html(),
                    skin: 'layui-layer-lan',
                    anim: 1,
                });
                //alert(data.tabaseName+","+data.);
                //将当前行数据显示在表单各字段中
                form.val("tabaseFormTest", {
                    "dataId":data.dataId,
                    "fundId":data.fundId,
                    "caId":data.caId,
                    "dates":data.dates,
                    "numbers":data.numbers,
                    "endDate":data.endDate,
                    "sumMoney":data.sumMoney,
                    "price":data.price,
                    "expenses":data.expenses,
                    "conagen":data.conagen,
                    "tranType":data.tranType,
                    "tranStatus":data.tranStatus,
                    "actMoney":data.actMoney
                });
                //将主键设置成只读:不允许修改
                $("input[name='dataId']").prop("readonly","readonly");
            }else if(obj.event == "delete"){//判断是否为行删除操作
                layer.confirm("真的删除交易数据编为"+data.dataId+"这行数据吗?", function(index){
                    //执行表格中删除操作
                    obj.del();
                    layer.close(index);
                    $.ajax({
                        type: "delete",
                        url: "/tabasecrud/method/"+data.dataId,//后台Servlet路径/tabasecrud/tabases
                        success: function(msg){
                            layer.msg(msg);
                            //重新加载表格数据
                            table.reload('tabaseTable');
                        }
                    });
                });
            }
        });

        //多条件搜索
        //搜索表单中提交按钮的事件代码
        form.on("submit(provinceSearch)",function (data) {
            //定义表单数据对象
            var formData=data.field;
            //得到表单数据json字符串
            var json=JSON.stringify(data.field);
            //alert(json);
            //重新加载表格对象
            table.reload("tabaseTable",{
                //页码
                page:{
                    curr:1
                },
                //条件数据，会带到后台
                where:{
                    dates:formData.dates,
                    tranType:formData.tranType
                }
            });
            return false;
        });
    });
</script>
</body>
</html>